package com.igoal.comparator;

import java.util.Comparator;

import com.igoal.entity.CommentEntry;

/**
 * Sort by updateDate property
 * @author Tri
 *
 */
public class CommentEntryComparator extends BaseComparator implements Comparator<CommentEntry>{	
	
	public CommentEntryComparator(boolean isASC) {
		this.isASC = isASC;
	}
	
	public int compare(CommentEntry o1, CommentEntry o2) {
		if(o1 != null & o2 != null){
			if(isASC)
				return o1.getUpdateDate().compareTo(o2.getUpdateDate());
			else
				return o2.getUpdateDate().compareTo(o1.getUpdateDate());
		}
		return 0;
	}

}
